<template>
  <div>
    <script id="editor" type="text/plain" ></script>
  </div>
</template>
<script>
export default {
    name: 'ueditor',
    data () {
        return {
            editor: null
        }
    },
    props: {
        id: {
            type: String
        },
        config: {
            type: Object
        },
        html:{
          type:String
        }
    },
    mounted () {
        console.log(this.config)
        const that = this
        // console.log(window.UE)
        that.editor = window.MUE = window.UE.getEditor('editor', that.config)

        // setTimeout(function(){
        //   that.editor.setContent("进入")
        // },200)
    },
    destroyed () {
        this.editor.destroy()
    },
    methods: {
        
        getUEContent: function () {
            return this.editor.getContent()
        },
        importxml:function(){
          let xml = this.editor.execCommand("importxml")
          return xml
        },
        setHtml:function (e){
            this.editor.execCommand("insertHtml",decodeURIComponent(e), false)
        },
        getHtml:function(){
          console.log(this.editor.getAllHtml())
        }

    }
}
</script>
